<template>
  <view class="training-record-container">
    <!-- 状态栏占位 -->
    <view class="status-bar" :style="{height: statusBarHeight + 'px'}"></view>
    
    <!-- 顶部导航栏 -->
    <view class="training-navbar">
      <view class="navbar-content">
        <view class="nav-left" @click="goBack">
          <text class="back-icon">‹</text>
        </view>
        <text class="nav-title">测量训练仪</text>
        <view class="nav-right">
          <view class="nav-action-btn">
            <text class="action-dots">⋯</text>
          </view>
          <view class="nav-action-btn">
            <text class="action-location">📍</text>
          </view>
        </view>
      </view>
    </view>

    <!-- 内容区域 -->
    <view class="content-area">
      <!-- 训练信息卡片 -->
      <view class="training-info-card">
        <view class="info-row">
          <text class="info-label">训练模式:</text>
          <text class="info-value blue-text">模式名称</text>
        </view>
        <view class="info-row">
          <text class="info-label">已训练时长:</text>
          <text class="info-value blue-text">1小时</text>
        </view>
        <view class="info-row">
          <text class="info-label">训练时长:</text>
          <text class="info-value blue-text">1小时50分钟</text>
        </view>
        <view class="training-date">
          <text class="date-text">2025/05/20 17:45</text>
        </view>
      </view>
      
      <!-- 蓝牙连接状态 -->
      <view class="bluetooth-section">
        <view class="bluetooth-icon">
          <text class="bt-icon">🔵</text>
        </view>
        <text class="bluetooth-status">蓝牙已连接</text>
      </view>
      
      <!-- 操作按钮区域 -->
      <view class="action-buttons">
        <view class="primary-btn" @click="startTraining">
          <text class="btn-text">开始/完成测量</text>
        </view>
        <view class="secondary-buttons">
          <view class="secondary-btn" @click="bindDevice">
            <text class="btn-text">绑定设备</text>
          </view>
          <view class="secondary-btn" @click="myDevice">
            <text class="btn-text">我的设备</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0
    }
  },
  
  onLoad() {
    this.getSystemInfo()
  },
  
  methods: {
    getSystemInfo() {
      const systemInfo = uni.getSystemInfoSync()
      this.statusBarHeight = systemInfo.statusBarHeight || 0
    },
    
    goBack() {
      uni.navigateBack()
    },
    
    startTraining() {
      uni.showToast({
        title: '开始训练',
        icon: 'success'
      })
    },
    
    bindDevice() {
      uni.navigateTo({
        url: '/pages/bindDevice/index'
      })
    },
    
    myDevice() {
      uni.navigateTo({
        url: '/pages/myDevice/index'
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.training-record-container {
  min-height: 100vh;
  background: #F5F5F5;
  position: relative;
}

.status-bar {
  background: #FFFFFF;
}

.training-navbar {
  background: #FFFFFF;
  height: 88rpx;
  border-bottom: 1px solid #E5E5E5;
  
  .navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 32rpx;
    
    .nav-left {
      width: 60rpx;
      height: 60rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      
      .back-icon {
        font-size: 48rpx;
        color: #333333;
        font-weight: bold;
      }
    }
    
    .nav-title {
      font-size: 36rpx;
      font-weight: bold;
      color: #333333;
    }
    
    .nav-right {
      display: flex;
      align-items: center;
      
      .nav-action-btn {
        width: 60rpx;
        height: 60rpx;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 16rpx;
        
        .action-dots, .action-location {
          font-size: 24rpx;
          color: #666666;
        }
      }
    }
  }
}

.content-area {
  padding: 60rpx 32rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.training-info-card {
  width: 100%;
  background: #FFFFFF;
  border-radius: 24rpx;
  padding: 40rpx 32rpx;
  margin-bottom: 80rpx;
  box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
  
  .info-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32rpx;
    
    .info-label {
      font-size: 32rpx;
      color: #333333;
      width: 220rpx;
      text-align: right;
      margin-right: 16rpx;
    }
    
    .info-value {
      font-size: 32rpx;
      font-weight: 500;
      flex: 1;
      
      &.blue-text {
        color: #2196F3;
      }
    }
  }
  
  .training-date {
    margin-top: 40rpx;
    text-align: center;
    
    .date-text {
      font-size: 28rpx;
      color: #666666;
    }
  }
}

.bluetooth-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 60rpx;
  
  .bluetooth-icon {
    width: 120rpx;
    height: 120rpx;
    background: #2196F3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24rpx;
    
    .bt-icon {
      font-size: 48rpx;
      color: #FFFFFF;
    }
  }
  
  .bluetooth-status {
    font-size: 32rpx;
    color: #333333;
    font-weight: 500;
  }
}

.action-buttons {
  width: 100%;
  
  .primary-btn {
    width: 100%;
    height: 96rpx;
    background: #2196F3;
    border-radius: 48rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32rpx;
    
    .btn-text {
      font-size: 32rpx;
      color: #FFFFFF;
      font-weight: 500;
    }
  }
  
  .secondary-buttons {
    display: flex;
    gap: 32rpx;
    
    .secondary-btn {
      flex: 1;
      height: 80rpx;
      background: #FFFFFF;
      border: 2rpx solid #2196F3;
      border-radius: 40rpx;
      display: flex;
      align-items: center;
      justify-content: center;
      
      .btn-text {
        font-size: 28rpx;
        color: #2196F3;
        font-weight: 500;
      }
    }
  }
}
</style> 